package br.com.yurikimo.ykkit;

import java.util.Hashtable;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class YKTextureManager{
	private Hashtable<String, Bitmap> fontHashTable = new Hashtable<String, Bitmap>();
	private static YKTextureManager instance;
	
	private static YKTextureManager getInstance(){
		if (instance == null){
			instance = new YKTextureManager();
		}
		
		return instance;
	}
	
	public static Bitmap loadImage(int imageId){
		Bitmap bitmap = getInstance().fontHashTable.get(String.valueOf(imageId));
		
		if (bitmap == null){
			bitmap = BitmapFactory.decodeResource(YKDirector.getActivity().getResources(), imageId);
			
			getInstance().fontHashTable.put(String.valueOf(imageId), bitmap);
		}
		
		return bitmap;
	}
}
